﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;

namespace FierceWar
{
	public class Screen
	{
		protected GameResources Resources;
		protected EventHandler ScreenEvent;
		protected List<EventHandler> ScreenEvents;
		protected Rectangle FullScreen;
		
		public Screen(GameResources resources, EventHandler screenEvent)
		{
			Resources = resources;
			ScreenEvent = screenEvent;
			FullScreen = new Rectangle(
				0, 0, Resources.GraphicsDevice.Viewport.Width,
				Resources.GraphicsDevice.Viewport.Height);
		}

		public Screen(GameResources resources, List<EventHandler> screenEvents)
		{
			Resources = resources;
			ScreenEvents = screenEvents;
			FullScreen = new Rectangle(
				0, 0, Resources.GraphicsDevice.Viewport.Width,
				Resources.GraphicsDevice.Viewport.Height);
		}

		public virtual void Update(GameTime gameTime)
		{
		}

		public virtual void Draw(GameTime gameTime)
		{
		}

		public virtual void Reset()
		{
		}

		public virtual void PlayMusic()
		{
			MediaPlayer.IsRepeating = true;
			MediaPlayer.Volume = 0.75f;
		}

		public virtual void StopMusic()
		{
			MediaPlayer.Stop();
		}

		public void FadeToBlack(float alpha)
		{
			Resources.SpriteBatch.Draw(Resources.BlankTexture,
				Resources.GraphicsDevice.Viewport.Bounds, Color.Black * alpha);
		}
	}
}
